package com.zhouyu.fileSync.FSserver.registerServer.Impl;

import com.zhouyu.fileSync.FScommon.annotations.RpcService;
import com.zhouyu.fileSync.FScommon.api.RegisterServiceRPC;
import com.zhouyu.fileSync.FScommon.entities.FSClient;
import com.zhouyu.fileSync.FSserver.registerServer.RegisterServer;

/**
 * Created by zhouyu@lightinthebox.com on 2019/8/8
 **/
@RpcService
public class RegisterServiceRPCImpl implements RegisterServiceRPC {

    public boolean registerClient(FSClient fsc) {
        RegisterServer.FSC_MAP.put(fsc.getClientName()+"@"+fsc.getClientPassword(),fsc);
        System.out.println(fsc.getClientName()+"注册成功");
        return true;
    }

    public FSClient getClient(String clientName, String clientPassword) {
        return RegisterServer.FSC_MAP.get(clientName+"@"+clientPassword);
    }
}
